import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/6/25 13:23
 */

public class Solution {
    public int halveArray(int[] nums) {
        // 创建一个最大堆
        PriorityQueue<Double> heap = new PriorityQueue<>((a, b) -> b.compareTo(a));
        double sum = 0.0;
        for (int i : nums) {
            heap.offer((double) i);
            sum += i;
        }
        sum /= 2;
        // 初始化计数器
        int count = 0;
        while (sum > 0) {
            // 从堆中取出最大的元素，并将其除以2
            double t = heap.poll() / 2.0;
            // 将数组的总和减去除以2后的元素
            sum -= t;
            count++;
            heap.offer(t);
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.halveArray(nums));
        }
    }
}